package com.ellecity06.cwhiskymall.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.chad.library.adapter.base.BaseSingleItemAdapter
import com.ellecity06.common.viewholder.ViewBindingHolder
import com.ellecity06.cwhiskymall.databinding.ItemNewerHeaderBinding
import com.ellecity06.cwhiskymall.storage.UserStorage

/**
 * @author ellecity06
 * @time 2024/11/19 15:13
 * @des
 */
class NewerHeaderAdapter : BaseSingleItemAdapter<Boolean, ViewBindingHolder<ItemNewerHeaderBinding>>() {
    override fun onCreateViewHolder(
        context: Context,
        parent: ViewGroup,
        viewType: Int
    ): ViewBindingHolder<ItemNewerHeaderBinding> {

        return ViewBindingHolder(
            ItemNewerHeaderBinding.inflate(
                LayoutInflater.from(context),
                parent,
                false
            )
        )
    }

    override fun onBindViewHolder(holder: ViewBindingHolder<ItemNewerHeaderBinding>, item: Boolean?) {
        if (UserStorage.isHasUp()){
            holder.binding.llBar.visibility =View.GONE
            if (!UserStorage.isVip()) {
                holder.binding.bg198.visibility = View.VISIBLE
                holder.binding.bgOther.visibility = View.GONE
            } else {
                holder.binding.bg198.visibility = View.GONE
                holder. binding.bgOther.visibility = View.VISIBLE
            }
        }else {
            holder.binding.llBar.visibility =View.VISIBLE
            holder.binding.bgOther.visibility = View.GONE
            holder.binding.bg198.visibility = View.GONE
        }

    }
}